package com.xfcy.blog.controller.system;



import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xfcy.blog.annotation.OperationLogger;
import com.xfcy.blog.common.R;
import com.xfcy.blog.entity.WebConfig;
import com.xfcy.blog.service.WebConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 网站配置表(WebConfig)表控制层
 *
 * @author 晓风残月Lx
 * @since 2023-04-09 11:03:06
 */
@RestController
@RequestMapping("system/webConfig")
@Api(tags = "网站配置管理")
public class WebConfigController {

    @Resource
    private WebConfigService webConfigService;

    @GetMapping("/list")
    @ApiOperation(value = "网站配置列表", httpMethod = "GET", response = R.class, notes = "网站配置列表")
    @SaCheckLogin
    public R list() {
        return webConfigService.listWebConfig();
    }

    @OperationLogger(value = "修改网站配置")
    @PostMapping(value = "/update")
    @SaCheckPermission("/system/webConfig/update")
    @ApiOperation(value = "修改网站配置", httpMethod = "POST", response = R.class, notes = "网站配置列表")
    public R update(@RequestBody WebConfig webConfig) {
        return webConfigService.updateWebConfig(webConfig);
    }

}

